

export default function request(option) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: App.config.baseApi + option.url,
      method: option.method || 'post',
      data: option.data || {},
      header: {
        ...option.header,
        'content-type': 'application/x-www-form-urlencoded;charset=utf-8' // 默认值
      },
      success: resolve,
      fail: reject
    })
  })
}

/* export default function request(option) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: option.url,
      method: option.method || 'get',
      data: option.data || {},
      success(res) {
        resolve(res)        
      },
      fail(err) {
        reject(err)
      }
    })
  })
} */